package com.ewanghuiju.app.ui.home.adapter;

import android.view.ViewGroup;

import com.ewanghuiju.app.ui.home.fragment.ChoicestFragment;
import com.ewanghuiju.app.ui.home.fragment.HomeFragment;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.PagerAdapter;

/**
 * @author sj  qq:751943509
 * @class describe
 * @time 2020/2/17
 */
public class HomePagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments;

    public HomePagerAdapter(@NonNull FragmentManager fm, int behavior, List<Fragment> fragments) {
        super(fm, behavior);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return HomeFragment.typeStr[position];
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    public int getItemPosition(Object object) {
        return PagerAdapter.POSITION_NONE;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
//        super.destroyItem(container, position, object);
    }
}
